<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>套餐管理</title>
<link href="../css/mq.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">	
	function add(){
		window.location.href = "addCharge.do";
	}
	function edit(id){
		var epage = '<s:property value="page"/>';
		url = "modifyCharge.do?scId1=" + id +"&page=" +epage;
		window.location.href = url;
	}
	function del(){
		document.problemform.action = "deleteCharge.do";
		document.problemform.submit();
	}
	
	function checkDel(){
		var checkboxs = document.getElementsByName("chb");
		for(var i=0;i<checkboxs.length;i++)
	    {
	      if(checkboxs[i].checked){
	      	  if(confirm("确定要删除选中记录么?")){
					document.problemform.action = "deleteCharge.do";
					document.problemform.submit();		
					return false; 
	      	  }else{
	      	  		return false; 
	      	  }
	      }
	    }
	    alert("请至少选择一项需要删除的条目!");
	    return false;  
    }
    
    function Del(id){
      var delurl;
	  if(confirm("确定要删除选中记录么?")){
	    delurl = 'deleteChargeSingle.do?id='+id;
	  	location.href=delurl;
	  }else{
	    return false;
	  }
	}
</script>
</head>

<body>

<div id="write">
<s:form name="chargeform" action="getChargeList" method="post">
 <h4>套餐管理</h4>
   
    <table width="99%" border="0" cellspacing="1" cellpadding="2" class="TableStyle">

  <tr class="TrTitleBg-2">
  	<td width=5% align = "center">&nbsp;</td>
    <td width=8% align = "center">序号</td>
    <td width=30% align = "center">套餐名称</td>
    <td width=15% align = "center">价格</td>
    <td width=20% align = "center">操作</td>
  </tr>
    

  <s:iterator value="charges" id="st" status ="sr">
   <tr class="TrWhiteBg"> 
    <td width=5% align = "center">
	    <label>
      		<input type="checkbox" name="chb" id="adu" value = '<s:property value="id"/>'/>
    	</label>
	    </td>
	<td width=8% align = "center">
		${sr.count }
	</td>
	<td width=30% align = "center">
		<a href='modifyCharge.do?id=<s:property value="id"/>'><s:property value="chargeName" /></a>
	</td>
	<td width=15% align = "center">
		<s:property value="price" />
	</td>

	<!-- 
	<td width=35% align = "center">
		<a href='editCategory.do?id=<s:property value="id"/>'><s:property value="scId" /></a>
	</td>
	 -->
	 <td width=20% align = "center">
		<a href='modifyCharge.do?id=<s:property value="id"/>'>编辑</a>
		<a href="#" onclick = "Del(<s:property value="id"/>);return false;" >删除 </a>
	</td>
 </tr>
 </s:iterator>
 
</table>
	<div style = "float:left;width:320px;margin:8px 10px 5px 0px;">
   	  <input name="添加套餐" type="button" value="添加套餐" class="buttonstyle-4word" onclick = "add()"/>
   	  <input name="删  除" type="button" value="删  除" class="buttonstyle-2word" onclick = "checkDel()"/>
    </div>
    
    <div align="right" class="text_margin">
  [ <a href="getChargeList.do?pageNum=1">首页</a> |
     <s:if test="pageNum<=1">上一页</s:if><s:else><a href="getChargeList.do?pageNum=${backPage }">上一页</a></s:else>|
     <s:if test="pageNum>=pageCount">下一页</s:if><s:else><a href="getChargeList.do?pageNum=${nextPage }">下一页</a></s:else> |
      <a href="getChargeList.do?pageNum=${pageCount }">末 页</a>]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第
	<select onchange="javascript:window.location='getChargeList.do?pageNum='+this.value">
		<s:bean name="org.apache.struts2.util.Counter">
		<s:param name="first" value="1" />
		<s:param name="last" value="pageCount"/>
		<s:iterator>
		<option value="<s:property />"
		<s:if test="%{pageNum==(current-1)}">selected="selected"</s:if>>
		<s:property />
		</option>
		</s:iterator>
		</s:bean>
	</select>
    页 &nbsp;共${pageCount }页   
  </div>   
	
</s:form>
</div>

</body>
</html>

